'use strict';

import Base from './base.js';
import MODEL from '../model/index.js';

export default class extends Base {
  /**
   * index action
   * @return {Promise} []
   */
  indexAction(){
    //auto render template file index/index.html
    return this.display();
  }
  errorAction(){
    return think.statusAction(400, this.http); //显示 600 错误，需要将 http 对象传递进去
  }
  testAction(){
    //auto render template file index/index.html
    console.log( this.get('name'))
    return this.success('data');
  }
  // async addAction(){
  //   let model = this.model('person');
  //   let insertId = await model.add({name: 'sh'+Math.floor(Math.random()*100)});
  //   return this.success("添加成功")
  // }
  // async updateAction(){
  //   let data = this.model('person').getMin();
  //   this.success(data)
  // }
   async findAction(){
    let model = this.model('bank_employee');
    let result = await model.page(this.get('page'), 10).countSelect();
    this.success(result)
  }
}